<template>
	<view>
		<view class="section">
			<uni-list>
				<uni-list-item title="个人资料" showArrow clickable @click="navto('跳转个人资料')"></uni-list-item>
				<uni-list-item title="收货地址" showArrow clickable @click="navto('跳转收货地址')"></uni-list-item>
				<uni-list-item title="实名认证" showArrow clickable @click="navto('跳转实名认证')"></uni-list-item>
			</uni-list>
		</view>

		<view class="section">
			<uni-list>
				<uni-list-item title="消息推送" showSwitch="true" switchChecked="true"></uni-list-item>
			</uni-list>
		</view>

		<view class="section">
			<uni-list>
				<uni-list-item title="清除缓存" showArrow clickable></uni-list-item>
				<uni-list-item title="关于拾尚" showArrow clickable @click="navto('跳转关于拾尚')"></uni-list-item>
				<uni-list-item title="检查更新" showArrow clickable rightText="当前版本 1.0.0" @click="navto('已经是最前沿的拾尚了')">
				</uni-list-item>
			</uni-list>
		</view>

		<button type="primary" class="logout" @click="tologout">退出登录</button>
	</view>

</template>

<script>
	import {mapMutations} from 'vuex';

	export default {
		data() {
			return {

			}
		},
		methods: {
			...mapMutations(['logout']),
			
			navto(url) {
				this.$api.msg(url);
			},
			tologout() {
				uni.showModal({
					title: '提示',
					content: '确定要退出登录吗?',
					success: (res) => {
						if (res.confirm) {
							this.logout();
						
							setTimeout(() => {
								uni.navigateBack();
							}, 500)
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F7F7F7
	}

	.section {
		margin-top: 20rpx;
	}

	.logout {
		margin-top: 40rpx;
		width: 80%;
	}
</style>
